<?php
/**
 * @version		$Id: server.php 2011.08.11 thierry $
 * @package		admin.models.fields
 * @subpackage	com_projid
 * @copyright	Copyright (C) 2011 Pojid All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// No direct access to this file
defined('_JEXEC') or die;

// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');

/**
 * Projid Form Field class for the Projid component
 */
class JFormFieldServer extends JFormFieldList
{
	/**
	 * The field type.
	 *
	 * @var		string
	 */
	protected $type = 'Server';

	/**
	 * Method to get a list of options for a list input.
	 *
	 * @return	array		An array of JHtml options.
	 */
protected function getOptions() 
	{
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);
		$query->select('id_serv, desc_serv');
		$query->from('#__projid_server');
		$db->setQuery((string)$query);
		$result = $db->loadObjectList();
		$options = array();
		if ($result)
		{
			foreach($result as $entry) 
			{
	$options[] = JHtml::_('select.option', $entry->id_serv, $entry->desc_serv);
		
			}
		}
		$options = array_merge(parent::getOptions(), $options);
		
	return $options;
	}
}
